#define _CRT_SECURE_NO_WARNINGS
#include"string.h"
using namespace lbj;


void test_string1(lbj::string& str)
{
	cout << str.size() << endl;
}

void test_string2(lbj::string& str)
{
	cout << str.capacity() << endl;
	char tmp[] = "!Everything will be okay!";
	str += tmp;
	cout << str<< endl;
	cout << str.capacity() << endl;
}

void test_string3(lbj::string& str)
{
	cout << str.empty() << endl;
}

void test_string4(lbj::string& str)
{
	cout << str << endl;
	cout << str.size() << endl;
	cout << str.capacity() << endl;


	str.resize(5, '*');
	cout << str << endl;
	cout << str.size() << endl;
	cout << str.capacity() << endl;

	str.resize(30, '*');
	cout << str << endl;
	cout << str.size() << endl;
	cout << str.capacity() << endl;
}

void test_string5(lbj::string& str)
{
	cout << str << endl;
	cout << str.capacity() << endl;
	str.reserve(20);
	cout << str.capacity() << endl;
}

void test_string6(lbj::string& str)
{
	cout << str << endl;
	cout << str.capacity() << endl;

	str.push_back('#');
	str.push_back('#');
	str.push_back('#');
	str.push_back('#');
	str.push_back('#');
	cout << str << endl;
	cout << str.capacity() << endl;
}

void test_string7(lbj::string& str)
{
	cout << str << endl;
	cout << str.capacity() << endl;
	char tmp[] = "!Everything will be okay!";
	str.append(tmp);
	cout << str << endl;
	cout << str.capacity() << endl;
}

void test_string8(lbj::string& str)
{
	cout << str << endl;
	cout << str.capacity() << endl;

	str += '*';
	cout << str << endl;
	cout << str.capacity() << endl;

	char tmp[] = "!Everything will be okay!";
	str += tmp;
	cout << str << endl;
	cout << str.capacity() << endl;
}

void test_string9(lbj::string& str)
{
	lbj::string tmp("Everything will be okay!");
	cout << str << endl;
	cout << tmp << endl;
	str.swap(tmp);
	cout << str << endl;
	cout << tmp << endl;
}

void test_string10(lbj::string& str)
{
	cout << str << endl;
	cout << str.find('o') << endl;
	cout << str.find("wor") << endl;
}

void test_string11(lbj::string& str)
{
	cout << str << endl;
	cout << str.size() << endl;
	str.insert(6, '*');
	cout << str << endl;
	cout << str.size() << endl;
	str.insert(3, "*****");
	cout << str << endl;
	cout << str.size() << endl;
}

void test_string12(lbj::string& str)
{
	cout << str << endl;
	cout << str.size() << endl;
	str.erase(3, 4);
	cout << str << endl;
	cout << str.size() << endl;
}

int main()
{
	lbj::string s1("hello world");
	lbj::string s2 = s1;

	test_string12(s2);
	return 0;
}